package com.lecture.java8.graph.demo01;

public class Village {

    int id;
    String name;
    int x, y;
    String description;

    public Village(int id, String name, int x, int y, String description) {
        this.id = id;
        this.name = name;
        this.x = x;
        this.y = y;
        this.description = description;
    }

    public double distanceTo(Village other) {
        return Math.round(Math.sqrt(Math.pow(this.x - other.x, 2) + Math.pow(this.y - other.y, 2)));
    }

    @Override
    public String toString() {
        return "Village{id=" + id + ", name='" + name + "', (x,y)=(" + x + "," + y + "), desc='" + description + "'}";
    }

}
